// ComplierNote.h: interface for the ComplierNote class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_COMPLIERNOTE_H__D35DAE99_2756_4E8C_A5D1_17575119DBB5__INCLUDED_)
#define AFX_COMPLIERNOTE_H__D35DAE99_2756_4E8C_A5D1_17575119DBB5__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "AccidenceAnalyzer.h"
#include "Variable.h"
#include "SmallObject.h"

class ComplierNote : public SmallObject
{
public:
	ComplierNote();
	virtual ~ComplierNote();

public:
	virtual BOOL Interpret() = 0;
	virtual Variable Execute() = 0;

public:
	void AAnalyzer(AccidenceAnalyzer* pAAnalyzer){
		ASSERT(pAAnalyzer);
		m_pAAnalyzer = pAAnalyzer;
	}

	void PStack(PropertyStackInterface* pStack){
		ASSERT(pStack);
		m_pPStack = pStack;
	}

	void EReporter(ErrorReporter* pReporter){
		m_pErrorReporter = pReporter;
	}

	ComplierNote* GetOwner(){
		return m_pOwner;
	}

	void SetOwner(ComplierNote* pNote){
		ASSERT(pNote);
		ASSERT(pNote->AAnalyzer());
		ASSERT(pNote->PStack());
		ASSERT(pNote->EReporter());

		AAnalyzer(pNote->AAnalyzer());
		PStack(pNote->PStack());
		EReporter(pNote->EReporter());

		m_pOwner = pNote;
	}

	ComplierNote* LeftNote(){
		return m_pLeftNote;
	}

	ComplierNote* RightNote(){
		return m_pRightNote;
	}

	void LeftNote(ComplierNote* pLeftNote){
		m_pLeftNote = pLeftNote;
	}

	void RightNote(ComplierNote* pRightNote){
		m_pRightNote = pRightNote;
	}

	AccidenceAnalyzer* AAnalyzer(){
		return m_pAAnalyzer;
	}

	PropertyStackInterface* PStack(){
		return m_pPStack;
	}

	ErrorReporter* EReporter(){
		return m_pErrorReporter;
	}

	void ErrorInfo(const CString& strInfo){
		m_strErrorInfo = strInfo;
	}

	const CString& ErrorInfo() const {
		return m_strErrorInfo;
	}

private:
	ComplierNote* m_pLeftNote;
	ComplierNote* m_pRightNote;
	ComplierNote* m_pOwner;

private:
	AccidenceAnalyzer* m_pAAnalyzer;
	PropertyStackInterface* m_pPStack;
	ErrorReporter* m_pErrorReporter;
	CString m_strErrorInfo;
};

#endif // !defined(AFX_COMPLIERNOTE_H__D35DAE99_2756_4E8C_A5D1_17575119DBB5__INCLUDED_)
